def anagrams(a, b):
    result = []
    for x in b:
        if set(a) == set(x):
            result.append(x)
    return list(set(result))
                
            
                
                
                
            


print anagrams('abba', ['aabb', 'abcd', 'bbaa', 'dada'])
print anagrams('racer', ['crazer', 'carer', 'racar', 'caers', 'racer'])
print anagrams('laser', ['lazing', 'lazy',  'lacer'])